package net.tolkv.test.util;

import com.tolkv.tdd.ws.AmazonItem;

public class AmazonItemBuilder {
	private AmazonItem item;

	public AmazonItemBuilder() {
		super();
		item=new AmazonItem();
	}
	
	public AmazonItemBuilder withId(long id){
		item.setId(id);
		return this;
	}
	
	public AmazonItemBuilder withName(String name){
		item.setName(name);
		return this;
	}
	
	public AmazonItemBuilder withPrice(float price) {
		item.setPrice(price);
		return this;
	}
	
	public AmazonItemBuilder withQuantity(int q){
		item.setQuantity(q);
		return this;
	}
	
	public AmazonItem build(){
		return newItemFrom(item);
	}
	
	public AmazonItem buildOne(){
		return this.withId(100000).withName("One").withPrice(10000.0f).withQuantity(10000).build();
	}
	
	public AmazonItem buildTwo(){
		return this.withId(200000).withName("Two").withPrice(20000.0f).withQuantity(2).build();
	}

	private AmazonItem newItemFrom(AmazonItem i) {
		AmazonItem ret=new AmazonItem();
		ret.setId(i.getId());
		ret.setName(i.getName());
		ret.setPrice(i.getPrice());
		ret.setQuantity(i.getQuantity());
		return ret;
	}
}
